<template>
  <el-select class="width-100" :value="internalValue" @change="onChange" v-bind="$attrs">
    <el-option v-for="option in options" :key="option.value" v-bind="option"></el-option>
  </el-select>
</template>

<script>
export default {
  inheritAttrs: false,
  name: 'chart-params',
  props: {
    value: String,
  },
  data () {
    return {
      internalValue: this.value,
      options: [
        { label: '当月', value: '1' },
        { label: '近三月', value: '2' },
        { label: '近半年', value: '3' },
        { label: '近一年', value: '4' },
      ]
    }
  },
  watch: {
    value (val) {
      this.internalValue = val
    }
  },
  methods: {
    onChange (item) {
      this.$emit('input', item)
      this.$emit('change', item)
    },
  },
}
</script>

<style scoped>

</style>
